home *** CD-ROM | disk | FTP | other *** search
- /*
- CenterText
- Center an IntuiText in a Bevel Box
- */
-
- OPTIONS RESULTS
-
- SIGNAL ON ERROR
-
- ADDRESS 'IEDITOR.1'
-
-
- /* Ask the user to select a text... */
-
- 'GETITEXT'
- txtn = result
-
- /* ...and a box */
-
- 'GETBOX'
- bevel = result
-
-
-
- /* Get the data we need */
-
- 'GETITEXTATTR' txtn txt
-
- 'GETITEXTLENGTH' txtn
- len = result
-
- if txt.font >= 0 then
- 'GETFONTATTR' txt.font fnt
- else
- 'GETSCRFONT' fnt
-
- 'GETBOXATTR' bevel bx
-
-
- /* Compute the new coordinates */
-
- newx = (bx.leftedge + TRUNC(( bx.width / 2),0)) - TRUNC((len / 2),0)
-
- newy = bx.topedge - TRUNC((fnt.ysize / 2),0) + 1
-
-
- /* Set RP_JAM2 and BackPen = 0 and center the text */
-
- 'SETITEXTATTR' txtn 'BP 0 M 1 X' newx 'Y' newy
-
-
- EXIT
-
-
- ERROR:
-
- say 'Error' RC 'on line' SIGL
-
- EXIT RC
-